<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
	<!--#header start-->
	{include file="public/_meta" /}
	<!--#header end-->

<title>栏目设置</title>
</head>
<body>
<div class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-category-add">
		<div id="tab-category" class="HuiTab">
			<div class="tabBar cl">
				<span>基本信息</span>
				<span>校验规则</span>
			</div>
			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">
						<span class="c-red">*</span>
						上级节点：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span class="select-box">
						<select class="select" id="sel_Sub" name="pid" >
							<option value="0">顶级分类</option>
							{volist name="ruleList" id="list"}
							<option value="{$list.id}">{$list.menu_name}({$list.name})</option>
								{if condition="array_key_exists('child',$list)"}
										{volist name="list.child" id="sonList"}
								     <option value="{$sonList.id}" disabled>&nbsp;&nbsp;├ {$sonList.menu_name}({$sonList.name})</option>
								    {/volist}
						    {/if}
              {/volist}
						</select>
						</span>
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>节点：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="Index/index" name="name" id="name" nullmsg="备注不能为空！">
						<label for="name" class="label label-warning radius">节点格式：控制器名/方法 or 控制器名</label>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">
						<span class="c-red">*</span>
						节点名称：
					</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="" id="menu_name" name="menu_name" nullmsg="备注不能为空！">
						 <label for="menu_name" class="label label-warning radius">节点名称：即显示的菜单名称</label>
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">节点描述：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<textarea name="title" class="textarea"  placeholder="说点什么...最少输入10个字符" datatype="*10-50" dragonfly="true" nullmsg="备注不能为空！" onKeyUp="$.Huitextarealength(this,50)"></textarea>
						<p class="textarea-numberbar"><em class="textarea-length">0</em>/50</p>
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">节点图标：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="" id="menu_icon" name="icon" nullmsg="备注不能为空！">
						 <label for="menu_icon" class="label label-success radius">节点图标：<a href="http://www.h-ui.net/Hui-3.7-Hui-iconfont.shtml">http://www.h-ui.net/Hui-3.7-Hui-iconfont.shtml</a></label>
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">排序：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="50" placeholder="" id="sort" name="" nullmsg="备注不能为空！">
					  <div class="col-3">
					  </div>
				  </div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">是否显示：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span class="select-box">
						<select name="is_show" class="select">
							<option value="1">显示</option>
							<option value="0">隐藏</option>
						</select>
						</span>
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">是否启用：</label>
					<div class="formControls col-xs-8 col-sm-9 skin-minimal">
						<div class="radio-box">
						 <input type="radio" id="radio-1" name="status" checked value="1">
						 <label for="radio-1">&nbsp;启用</label>
					 </div>
					 <div class="radio-box">
						 <input type="radio" id="radio-2" name="status" value="0">
						 <label for="radio-2">&nbsp;禁用</label>
					 </div>
					</div>
					<div class="col-3">
					</div>
				</div>
			</div>
			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">正则表达式：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" name="condition">
					</div>
					<div class="col-3">
					</div>
				</div>
			</div>
		</div>
		<div class="row cl">
			<div class="col-9 col-offset-3">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</div>

<!--#header start-->
{include file="public/_footer" /}
<!--#header end-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__ADMIN__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});

	$.Huitab("#tab-category .tabBar span","#tab-category .tabCon","current","click","0");

	$("#form-category-add").validate({
		rules:{
			name:{
				required:true,
				minlength:2,
				maxlength:64
			},
			menu_name:{
				required:true,
				minlength:2,
				maxlength:12
			},
			status:{
				required:true,
			},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit({
				type: 'post',
				url: "{:url('Auth/create')}" ,
				success: function(result){
					//console.log(result); //{state: true, msg: "新增成功"}
					if (result.state) {
						layer.msg(result.msg,{icon:1,time:1000});
						setTimeout(function(){
							 layer.closeAll('loading');
							 var index = parent.layer.getFrameIndex(window.name);
							 parent.layer.close(index);
						}, 2000);
					}else {
						layer.msg(result.msg,{icon:5,time:1000});
					}
				},
					error: function(XmlHttpRequest, textStatus, errorThrown){
					layer.msg('网络连接失败!',{icon:5,time:1000});
				}
			});
		}
	});
});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
